#pragma once

#include "CoreMinimal.h"
#include "SkeletalInstancedProxy.h"
#include "InstancedSkeletalMeshComponent.generated.h"

class FSkeletalInstancedProxy;

UCLASS(ClassGroup = Rendering, meta = (BlueprintSpawnableComponent), Blueprintable)
class SKELOT_API UInstancedSkeletalMeshComponent : public UActorComponent
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, Category=Instances)
	FSkeletalInstanceKey SkeletalInstanceKey;
public:
	UFUNCTION(Blueprintable, Category = "InstancedSkeletalMesh")
	int32 AddInstance(const FTransform& Transform, UAnimSequenceBase* InAnimation);

	UFUNCTION(Blueprintable, Category = "InstancedSkeletalMesh")
	void UpdateInstanceTransform(int32 InstanceIndex, const FTransform& Transform);

	UFUNCTION(Blueprintable, Category = "InstancedSkeletalMesh")
	void UpdateInstanceAnimation(int32 InstanceIndex, UAnimSequenceBase* InAnimation);

	UFUNCTION(Blueprintable, Category = "InstancedSkeletalMesh")
	void RemoveInstance(int32 InstanceIndex);
protected:
	TMap<int32, TSharedPtr<FSkeletalInstancedProxy>> InstancedProxyMap;
	int32 CurrentIndex = 1;
};